package com.jourwon.util.test.tree;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jourwon.util.tree.TreeNode;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * @author JourWon
 * @since 2021/4/6
 */
@Getter
@Setter
@Builder
@Accessors(chain = true)
public class Area implements Serializable {

    private static final long serialVersionUID = 7078136405446666159L;

    /**
     * 地区编码
     */
    private String areaCode;

    /**
     * 父地区编码
     */
    private String parentCode;

    /**
     * 地区名
     */
    private String areaName;

    /**
     * 当前数据转换为树节点
     *
     * @return TreeVO 树对象
     */
    @JsonIgnore
    public TreeNode getTreeDTO() {
        return TreeNode.builder().id(this.areaCode).parentId(this.parentCode).value(this.areaName).build();
    }

}
